package com.example.zeon;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        Button enterButton = (Button)findViewById(R.id.buttonLoginEnter);
//	    TextView userName = (TextView)findViewById(R.id.editLoginName);
//	    TextView password = (TextView)findViewById(R.id.editLoginPassword);
//	    CharSequence name = userName.getText();
//	    CharSequence pwd = password.getText();
//	    Toast warning = Toast.makeText(MainActivity.this, "错误，请重新输入", Toast.LENGTH_SHORT);
	    
	    View.OnClickListener l = new View.OnClickListener() {
	    	public void onClick(View v) {
	    		Intent intent = new Intent();
	    		intent.setClass(MainActivity.this, MenuActivity.class);
	    		startActivity(intent);
	    	}
	    };
	    	enterButton.setOnClickListener(l);
	    
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    
    //这里用来接受退出程序的指令
    @Override
    protected void onStart() {
	    int flag = getIntent().getIntExtra("flag", 0);
	    if(flag == SysUtil.EXIT_APPLICATION) {
	    	finish();
	    }
	    super.onResume();
    }     
}
